{Prime Sum}
const
  max = 1000000;
var
  a : array[1..max] of boolean;
  p : array[1..9000] of longint;
  n, m : longint;

procedure init;
var
  i, j : longint;
begin
  fillchar(a, sizeof(a), true);
  for i := 2 to n do
    if a[i] then
    begin
      j := i + i;
      while j <= n do
      begin
        a[j] := false;
        inc(j, i);
      end;
    end;
end;

procedure process;
var
  i : longint;
begin
  m := 0;
  for i := 2 to n-2 do
    if a[i] and a[i+2] then
    begin
      inc(m);
      p[m] := i;
    end;
end;

procedure out;
var
  i : longint;
begin
  writeln(m);
  for i := 1 to m do writeln(2, ' ', p[i]);
end;

begin
  read(n);
  init;
  process;
  out;
end.
